package com.qyhl.webtv.module_circle.circle.userlist.fragment;

import android.widget.ImageView;

import com.qyhl.webtv.commonlib.entity.circle.CircleHomeBean;

import java.util.List;

/**
 * Created by qyhl on 2018/2/8.
 */

public class UserListPresenter implements UserListContract.UserListPresenter {
    private UserListFragment mView;

    private UserListModel mModel;

    public UserListPresenter(UserListFragment mView) {
        this.mView = mView;
        this.mModel = new UserListModel(this);
    }

    @Override
    public void getFans() {
        mModel.getFans();
    }

    @Override
    public void getFollow() {
        mModel.getFollow();
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void setDatas(List<CircleHomeBean.User> beanList) {
        mView.setDatas(beanList);
    }

    @Override
    public void doFollow(String dstUserName, ImageView follow, int position) {
        mModel.doFollow(dstUserName, follow, position);
    }

    @Override
    public void undoFollow(String dstUserName, ImageView follow, int position) {
        mModel.undoFollow(dstUserName, follow, position);
    }

    @Override
    public void followSuccess(String msg, ImageView follow, int position) {
        mView.followSuccess(msg, follow, position);
    }

    @Override
    public void followError(String msg) {
        mView.followError(msg);
    }

    @Override
    public void unFollowSuccess(String msg, ImageView follow, int position) {
        mView.unFollowSuccess(msg, follow, position);
    }

    @Override
    public void unFollowError(String msg) {
        mView.unFollowError(msg);
    }
}
